#ifndef _PROTOCOL_H__
#define _PROTOCOL_H__
#include "os/types.h"
/* 通信协议头部定义 */
#pragma  pack (push,1)
typedef struct {
	u8 version:4;
	u8 type   :4;
	u8 command;
}head_t;
#pragma  pack (pop)

#define PROT_VERSION_0    0

#define PROT_TYPE_REQUEST 1
#define PROT_TYPE_INDICAT 2
#define PROT_TYPE_ACK     2

/* 完整的包信息 */
typedef struct {
	u8 type;
	u8 command;
	u8 len;
	u8 *data;
}package_t;

void protocol_init(void);
void protocol_send_ack(package_t *pack, uint8_t success);
void protocol_send_indicator(u8 command, u8 *data, int len);
void protocol_send_package(head_t *head, u8 *data, int len);
void protocol_send_response(u8 command, u8 *data, int len);

#endif /* _PROTOCOL_H__ */
